PWD = $(shell pwd)
LIB = $(PWD)/lib
INC = $(PWD)/include

all: $(LIB)/Integer.o $(LIB)/libqdd.a $(LIB)/libbdd.a shornuf/shornuf

$(LIB)/Integer.o:
	cd Integer; make
	cd Integer; make install

$(LIB)/libqdd.a: $(LIB)/libbdd.a $(LIB)/Integer.o
	cd qdd; make
	cd qdd; make install

$(LIB)/libbdd.a:
	cd buddy-2.4; ./configure --includedir=$(INC) --libdir=$(LIB)
	cd buddy-2.4; touch Makefile.in
	cd buddy-2.4; touch config.h.in
	cd buddy-2.4; make
	cd buddy-2.4; make install

shornuf/shornuf: $(LIB)/libbdd.a $(LIB)/libqdd.a
	cd shornuf; make

clean:
	cd buddy-2.4; touch Makefile.in
	cd buddy-2.4; touch config.h.in
	cd buddy-2.4; make distclean
	cd shornuf; make clean
	cd qdd; make clean
	cd Integer; make clean
	cd lib; rm -f libg++.a libbdd.* libqdd.a Integer.o
	cd include; rm -f bdd.h bvec.h fdd.h qdd.h IntegerZ.h
